package com.example.patternfactory0307.factoryPattern.simpleFactory;
import com.example.patternfactory0307.factoryPattern.zCommonDoing.GREEAirConditioner;  //*****

/**
 * Created by huanglijun on 2019/3/7
 * 简单工厂 实际就是通过反射
 */
public class DemoTest {

    public static void main(String[] args) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
        /**
         *第一种方式：
         */
        com.example.patternfactory0307.factoryPattern.simpleFactory.GREEAirConditioner greeAirConditioner =
                (com.example.patternfactory0307.factoryPattern.simpleFactory.GREEAirConditioner)Class.forName("com.example.patternfactory0307.factoryPattern.simpleFactory.GREEAirConditioner")
                .newInstance();

        greeAirConditioner.reduceHeat();

        /**
         * 第二种方式：
         */
        GREEAirConditioner greeAirConditioner1 = GREEAirConditioner.class.newInstance();
        greeAirConditioner1.warmUpHeat();

    }


}
